﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;

namespace EmailClient.ViewModel
{
    public class Common
    {
        public static async Task<string> UpdateFolderTreeOnMainView()
        {
            var mw = (MainWindow)App.Current.MainWindow;
            return await mw.UpdateTree();
        }

        public static async Task<string> UpdateGridOnMainView()
        {
            var mw = (MainWindow)App.Current.MainWindow;
            return await mw.UpdateGrid();
        }

        public static bool isConnectionAvailable()
        {
            var result = false;
            Ping ping = new Ping();
            PingReply reply;
            try
            {
                reply = ping.Send("google.com", 10);
                if (reply.Status == IPStatus.Success) result = true;
            }
            catch { }
            return result;
        }
    }

    public class ColumnInfo
    {
        public string SortMemberPath { get; set; }
        public System.ComponentModel.ListSortDirection? SortDirection { get; set; }
    }
}
